package org.csmzxy.class2333;
//家电类
class ElectricalApp1{
    private String type;
    public ElectricalApp1(String type){ //父类有参构造方法
        this.type=type;
        System.out.println("父类有参构造方法被调用");
    }
    public String getType(){
        return type;
    }

}
//电视机类
class TV1 extends ElectricalApp1{
    private String brand;
    public TV1(String type,String brand){
        super(type); //使用super关键字调用父类构造方法
        this.brand=brand;
        System.out.println("子类有参构造方法被调用");
    }
    public String getBrand(){
        return brand;
    }
}


public class Example04 {
    public static void main(String[]args){
        TV1 tv =new TV1("电视机","黑马");
        System.out.println("此家电是一个"+tv.getType()+",它的品牌为:"+tv.getBrand());
    }
}
